#include "SystemHead.h"
#define FIFO "myfifo"
#define FIFO1 "myfifo1"
void main()
{
    mkfifo(FIFO,S_IRUSR|S_IWUSR);
    mkfifo(FIFO1,S_IRUSR|S_IWUSR);
    int FIFOfd=open(FIFO,O_WRONLY);
    if(FIFOfd==-1)
    {
        perror("open");
        exit(-2);
    }
    int FIFOfd1=open(FIFO1,O_RDONLY);
    if(FIFOfd1==-1)
    {
        perror("open");
        exit(-2);
    }
    while(1)
    {
        char buff[1024]={0};
        memset(buff,0,sizeof(buff));
        scanf("%[^\n]",buff);
        getchar();
        write(FIFOfd,buff,sizeof(buff));
        read(FIFOfd1,buff,sizeof(buff));
        printf("child %s\n",buff);   
    }
}